// var powerlist = ["/micro/ident-group:queryList","/micro/ident-group:add"];
<!--自定义函数判断权限-->
var userInfo = getAuthority();
var powerlist = JSON.parse(userInfo).permissions;
/*自定义函数判断权限*/
template.defaults.imports.hasPower = function(data){
    if(powerlist.includes(data)){
        return true;
    }
    return false;
};


layui.use(['layer', 'form', 'table', 'util', 'dtree','admin','laypage','tree'], function () {
    var $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;
    var table = layui.table;
    var util = layui.util;
    var dtree = layui.dtree;
    var admin = layui.admin;
    var laypage = layui.laypage;
    var tree = layui.tree;

    var Authorization;//请求接口用
    var count = 0;//总个数
    var current=1;//当前页
    var fistRenderPage= true;//是否第一次渲染分页
    var addMenuId = "root";
    var editMenu;
    var inflowData;
    var flowOutData;
    var first_table;
    var addPariseId;
    var editParised;
    var setting={//树设置
        identValueSetting:{//区划树设置
            edit: {
                enable: true,
                showRemoveBtn: false,
                showRenameBtn: false,
                drag: {
                    isCopy: true,
                    isMove: false,
                    prev: false,
                    next: false,
                    inner: false
                }
            },
            data: {
                key: {
                    children: "sub",
                    isParent: "isParent",
                    title: "name"
                },
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onExpand: onExpandIdentValueTree,
                onClick: identValueOnClick
            },
            view: {
                showIcon: true,
                showLine: true
            }
        },
    }
    var menuSetting = {//树设置
        identValueSetting:{//区划树设置
            edit: {
                enable: true,
                showRemoveBtn: false,
                showRenameBtn: false,
                drag: {
                    isCopy: true,
                    isMove: false,
                    prev: false,
                    next: false,
                    inner: false
                }
            },
            data: {
                key: {
                    children: "sub",
                    isParent: "isParent",
                    title: "name"
                },
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onExpand: addOnExpandIdentValueTree,
                onClick: addIdentValueOnClick
            },
            view: {
                showIcon: true,
                showLine: true
            }
        },
    }
    var idenSetting = {//树设置
        identValueSetting:{//区划树设置
            edit: {
                enable: true,
                showRemoveBtn: false,
                showRenameBtn: false,
                drag: {
                    isCopy: true,
                    isMove: false,
                    prev: false,
                    next: false,
                    inner: false
                }
            },
            data: {
                key: {
                    children: "sub",
                    isParent: "isParent",
                    title: "name"
                },
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onExpand: idenOnExpandIdentValueTree,
                onClick: idenIdentValueOnClick
            },
            view: {
                showIcon: true,
                showLine: true
            }
        },
    }
    var editIdenSetting = {//树设置
        identValueSetting:{//区划树设置
            edit: {
                enable: true,
                showRemoveBtn: false,
                showRenameBtn: false,
                drag: {
                    isCopy: true,
                    isMove: false,
                    prev: false,
                    next: false,
                    inner: false
                }
            },
            data: {
                key: {
                    children: "sub",
                    isParent: "isParent",
                    title: "name"
                },
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onExpand: editidenOnExpandIdentValueTree,
                onClick: editidenIdentValueOnClick
            },
            view: {
                showIcon: true,
                showLine: true
            }
        },
    }
    if(userInfo){
        var access_token = localStorage.getExpire("access_token");
        var token_type = localStorage.getExpire("token_type");
        Authorization = token_type+" "+access_token;
        inflow();
        flowOut();
        initidentMenuTree();
        // getTreeTable({},function (resArr) {
        //     $.fn.zTree.init($("#treeTbTree"), setting.identValueSetting, resArr);
        //     editMenu = resArr[0]
        //     // first_renderTree = true;
        //     getIdenData()
        // });
    }
    function initidentMenuTree(){
        var resArr = [{"data_type":0,
            "id":"root",
            "name":"根目录",
            "par_id":"",
            "version":"0",
            "sub":[]
        }];
        $.fn.zTree.init($("#treeTbTree"), setting.identValueSetting, resArr);
        editMenu = resArr[0]
        getIdenData()
        // getTreeTable({},function (resArr) {
        //     $.fn.zTree.init($("#treeTbTree"), setting.identValueSetting, resArr);
        //     editMenu = resArr[0]
        //     // first_renderTree = true;
        //     getIdenData()
        // });
    }
    //查询下方区划树的下级区划值（懒加载）
    function onExpandIdentValueTree(event, treeId, treeNode) {

        if(treeNode.sub.length>0||treeNode.hasChild=='0'){
            return false
        }
        getTreeTable(treeNode,function (resArr) {
            const treeObj = $.fn.zTree.getZTreeObj("treeTbTree");
            treeNode = treeObj.addNodes(treeNode,resArr);
        });
    }
    //新增渲染树形菜单
    function addOnExpandIdentValueTree(event, treeId, treeNode) {

        if(treeNode.sub.length>0||treeNode.hasChild=='0'){
            return false
        }
        getTreeTable(treeNode,function (resArr) {
            const treeObj = $.fn.zTree.getZTreeObj("menuTree");
            treeNode = treeObj.addNodes(treeNode,resArr);
        });
    }
    //指标弹窗里面目录
    function idenOnExpandIdentValueTree(event, treeId, treeNode) {

        if(treeNode.sub.length>0||treeNode.hasChild=='0'){
            return false
        }
        getTreeTable(treeNode,function (resArr) {
            const treeObj = $.fn.zTree.getZTreeObj("addIdenTree");
            treeNode = treeObj.addNodes(treeNode,resArr);
        });
    }
    //指标弹窗里面目录
    function editidenOnExpandIdentValueTree(event, treeId, treeNode) {

        if(treeNode.sub.length>0||treeNode.hasChild=='0'){
            return false
        }
        getTreeTable(treeNode,function (resArr) {
            const treeObj = $.fn.zTree.getZTreeObj("editIdenTree");
            treeNode = treeObj.addNodes(treeNode,resArr);
        });
    }
    //选中分组值
    function identValueOnClick(event, treeId, treeNode){
        // getTableData(treeNode.id,{})
        editMenu = treeNode
        getIdenData();
    }
    //选择新增菜单
    function addIdentValueOnClick(event, treeId, treeNode){
        // getTableData(treeNode.id,{})
        $("#choose_menu").val(treeNode.idenName)
        addMenuId = treeNode.id
    }
    //指标选择分组
    function idenIdentValueOnClick(event, treeId, treeNode){
        // getTableData(treeNode.id,{})

        $("#addPrevName").val(treeNode.idenName||treeNode.name)
        addPariseId = treeNode.id
    }
    //指标选择分组
    function editidenIdentValueOnClick(event, treeId, treeNode){
        // getTableData(treeNode.id,{})
        $("#editPrevName").val(treeNode.idenName||treeNode.name)
        editParised = treeNode.id
    }
    getTemplateIdenPower();
    getTemplateIdenManageTablePower();
    getIdentValuePower();
    //获取树形目录的值
    function getTreeTable(obj,callback) {
        let parent_id = obj.id?obj.id:'root';
        axios({
            method: 'get',
            url:idenManageUrl.idenManageMenu.searchIdenManageMenu+'/'+ parent_id + '/',
            headers:{
                'Authorization':Authorization
            }
        })
            .then(function (response) {
                if(response.status == 200 &&response.data.message == "success"){
                    var data = response.data.data;
                    var resArr = [];
                    zhuanHuanTree(data,resArr);
                    // IdentValueTree = resArr;
                    callback(resArr)
                }
            })
            .catch(function (error) {
                console.log(error);
                if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                    // 进行重新登陆
                    localStorage.clear();
                    top.location.href=loginPageUrl;
                }
            });
    }
    //转换菜单集合数据
    function zhuanHuanTree(tdata,resData) {

        if(Array.isArray(tdata) && tdata.length>0){
            tdata.forEach(function(v,i){
                var newValue=v.idenName;
                resData[i]=v;
                resData[i].title=newValue;
                resData[i].icon = "";
                resData[i].isParent = "true";
                resData[i].sub = [];
                resData[i].name = newValue
            });
        }
    }

    // 打开新增指标模板弹窗
    $('#addTemplateIdenBtn').click(function () {
        showTemplateIdenModel();
    });
    // 打开编辑指标模板弹窗
    $('#editTemplateIdenBtn').click(function () {
        var selectedTree = [];
        showEditIdenModel(selectedTree);
    });
    //删除指标模板
    $('#deleteTemplateIdenBtn').click(function () {
        var selectedTree = [];
        showDeleteTemplateIdenModel(selectedTree);
    });



    $("#closeIdenMoreFilterModel").click(function () {
        $("#idenMoreFilterModel").slideUp();
    });
    //汇总指标管理-新增指标
    $('#add-btn-template-idenManage').click(function () {
        openAddIdenManage();
    });
    $('#import-btn-template-idenManage').click(function () {
        openImportIdenManage();
    })

    // 表格工具条点击事件
    table.on('tool(identGroupTable)', function (obj) {
        var data = obj.data;
        var layEvent = obj.event;
        if (layEvent === 'edit') { // 修改
            showTdenManageEditModel(data);
        } else if (layEvent === 'delete') { // 删除
            showIdenManageDeleteModel(data);
        }
    });

    /*渲染指标管理权限*/
    function getTemplateIdenPower() {
        var str = template("template-idenManage-tmpl",{});
        document.getElementById("template-idenManage-tmpl-box").innerHTML = str;
    }
    /*渲染分组表格里的权限*/
    function getTemplateIdenManageTablePower() {
        var str = template("ident-template-idenManage-tmp",{});
        document.getElementById("ident-template-idenManage-box").innerHTML = str;
    }

    /*渲染指标模板权限*/
    function getIdentValuePower() {
        var str = template("template-iden-tmpl",{});
        document.getElementById("template-iden-tmpl-box").innerHTML = str;
    }



    /*渲染指标管理表格*/
    function renderTable(idenData) {
        table.render({
            elem: '#identGroupTable',
            size: 'sm', //小尺寸的表格
            // skin:'nob',
            data:idenData.records,
            page: false,
            cellMinWidth: 100,
            cols: [[
                {type:'numbers', title: '#'},
                {field: 'idenName', align: 'center', title: '指标名称'},
                {field: 'idenType', align: 'center', title: '数据类型',templet:function (d) {
                        return "数字"
                    }},
                {field: 'allName', align: 'center', title: '指标简称'},
                {field: 'memo', align: 'center', title: '描述'},
                {align: 'center', toolbar: '#ident-template-idenManage-box', title: '操作', minWidth: 120}
            ]]
        });

        //第一次才渲染分页
        if(fistRenderPage){
            laypage.render({
                elem: 'page-box'
                ,count: idenData.total,
                limit:idenData.size,
                groups:1,
                current:current
                ,layout: ['count','prev','page', 'next']
                ,jump: function(obj, first){
                    if(!first){
                        current = obj.curr;
                        fistRenderPage = false;
                        getIdenData();
                    }
                }
            });
        }
    }

    /*显示新增指标模板弹窗*/
    function showTemplateIdenModel(obj) {
        window.mSelUser = {
            nickName:"如可",
            sex:"女"
        };  // 传递数据到表单页面，也可以使用top.xxx
        admin.open({
            type: 1,
            title: '新增指标目录',
            offset: "auto",
            content: $('#AddTemplateIdenModel').html(),
            success: function (layero, dIndex) {
                if(addMenuId == 'root'){
                    $("#choose_menu").val("根目录");
                }
                form.render('checkbox')


                // getTreeTable({},function (resArr) {
                //     $.fn.zTree.init($("#menuTree"), menuSetting.identValueSetting, resArr);
                //     // parentId = resArr[0]
                //     // first_renderTree = true;
                //     // getTableData(resArr[0].id,{})
                // });
                var resArr = [{"data_type":0,
                    "id":"root",
                    "name":"根目录",
                    "par_id":"",
                    "version":"0",
                    "sub":[]
                }];
                $.fn.zTree.init($("#menuTree"), menuSetting.identValueSetting, resArr);


                form.on('submit(getAddMenuData)', function (current_data) {
                    //执行实例
                    let formData = {
                        "idenName": current_data.field.idenName,
                        "parid":addMenuId,
                    }
                    axios({
                        method: 'post',
                        data:formData,
                        url:idenManageUrl.idenManageMenu.addIdenManageMenu,
                        headers:{
                            'Authorization':Authorization
                        }
                    })
                        .then(function (res) {
                            if (res.status == 200&&res.data.message=="success") {
                                layer.closeAll('loading');
                                layer.msg("新增成功", {icon: 1});
                                // getTreeTable({},function (resArr) {
                                //     $.fn.zTree.init($("#treeTbTree"), setting.identValueSetting, resArr);
                                // });
                                initidentMenuTree();
                            } else {
                                layer.msg(res.data.message, {icon: 2});
                                layer.closeAll('loading');
                            }
                            layer.close(dIndex);
                        })
                        .catch(function (error) {
                            console.log(error);
                            if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                                // 进行重新登陆
                                localStorage.clear();
                                top.location.href=loginPageUrl;
                            }
                        })
                    return false;
                });

            }
        });
    }

    function showEditIdenModel(obj) {
        if(!editMenu){
            layer.msg("请选择需要修改的目录", {icon: 2});
            return false
        }
        if(editMenu.id=="root"){
            layer.msg("根目录不允许修改", {icon: 2});
            return false
        }
        admin.open({
            type: 1,
            title: '编辑指标目录',
            offset: "auto",
            content: $('#editIdenMenuModel').html(),
            success: function (layero, dIndex) {
                form.render('checkbox')
                // 回显数据
                form.val('editIdenMenuForm', editMenu);
                form.on('submit(editMenuData)', function (data) {
                    let form_data = {
                        "id":editMenu.id,
                        "version":editMenu.version,
                        "idenName": data.field.idenName,

                    }
                    axios({
                        method: 'put',
                        data:$.param(form_data),
                        url:idenManageUrl.idenManageMenu.editIdenManageMenu,
                        headers:{
                            'Authorization':Authorization
                        }
                    })
                        .then(function (res) {
                            if (res.status == 200&&res.data.message=="success") {
                                layer.closeAll('loading');
                                layer.msg("编辑成功", {icon: 1});
                                getTreeTable({},function (resArr) {
                                    $.fn.zTree.init($("#treeTbTree"), setting.identValueSetting, resArr);
                                });
                                editMenu = "";
                            } else {
                                layer.msg(res.data.message, {icon: 2});
                                layer.closeAll('loading');

                            }
                            layer.close(dIndex);

                        })
                        .catch(function (error) {
                            console.log(error);
                            if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                                // 进行重新登陆
                                localStorage.clear();
                                top.location.href=loginPageUrl;
                            }
                        })
                    return false;
                });
            }
        });
    }

    /*显示删除指标模板弹窗*/
    function showDeleteTemplateIdenModel() {
        if(!editMenu){
            layer.msg("请选择需要删除的目录", {icon: 2});
            return false
        }
        layer.confirm('确定将永久删除指标目录“'+editMenu.idenName+' ”吗？', {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
            layer.close(i);
            layer.load(2);
            axios({
                method: 'delete',
                url:idenManageUrl.idenManageMenu.deleteIdenManageMenu + editMenu.id,
                headers:{
                    'Authorization':Authorization
                }
            })
                .then(function (res) {
                    if (res.status == 200&&res.data.message=="success") {
                        layer.closeAll('loading');
                        layer.msg("删除成功", {icon: 1});
                        initidentMenuTree();
                        editMenu = ""
                    } else {
                        layer.msg(res.data.message, {icon: 2});
                        layer.closeAll('loading');
                    }
                    layer.closeAll('loading');

                })
                .catch(function (error) {
                    console.log(error);
                    if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                        // 进行重新登陆
                        localStorage.clear();
                        top.location.href=loginPageUrl;
                    }
                })
        });
    }

    /*显示编辑指标管理弹窗*/
    function showTdenManageEditModel(data) {
        layui.use(['admin'], function () {
            var $ = layui.jquery;
            var admin = layui.admin;
            var form = layui.form;
            admin.open({
                type: 1,
                title: '编辑指标',
                offset: "auto",
                area: ['400px', '800px'],
                content: $('#model-edit-idenManage').html(),
                success: function (layero, dIndex) {
                    // var url = mUser ? '/updateUser' : '/addUser';
                    // getTreeTable({},function (resArr) {
                    //     $.fn.zTree.init($("#editIdenTree"),editIdenSetting.identValueSetting, resArr);
                    //     // parentId = resArr[0]
                    //     // first_renderTree = true;
                    //     // getTableData(resArr[0].id,{})
                    // });
                    var resArr = [{"data_type":0,
                        "id":"root",
                        "name":"根目录",
                        "par_id":"",
                        "version":"0",
                        "sub":[]
                    }];
                    $.fn.zTree.init($("#editIdenTree"),editIdenSetting.identValueSetting, resArr);

                    $("#editPrevName").val(data.parName)
                    var inflow_str = template("template-editinflow-tmpl",{inflowData});
                    document.getElementById("editPrecision").innerHTML = inflow_str
                    var flowout_str = template("template-editflowOut-tmpl",{flowOutData});
                    document.getElementById("editUseTyoe").innerHTML = flowout_str
                    form.render('select')
                    // // 回显数据
                    form.val('editGroupForm', data);
                    // // 表单提交事件
                    form.on('submit(editIdenDataList)', function (form_data) {
                        let formData = {
                            idenName:form_data.field.idenName,
                            allName :form_data.field.allName,
                            idenType:2,
                            idenLength :form_data.field.idenLength,
                            idenPrecision :form_data.field.idenPrecision,
                            status :form_data.field.status?"1":"0",
                            memo:form_data.field.memo,
                            parid :editParised?editParised:data.parid,
                            dataProcurement :form_data.field.dataProcurement,
                            dataUse :form_data.field.dataUse,
                            id:data.id,
                            version:data.version
                        }
                        axios({
                            method: 'put',
                            data:formData,
                            url:idenManageUrl.idenManageData.editIdenMeta,
                            headers:{
                                'Authorization':Authorization
                            }
                        })
                            .then(function (res) {
                                if (res.status == 200&&res.data.message=="success") {
                                    layer.closeAll('loading');
                                    layer.msg("编辑成功", {icon: 1});
                                    getIdenData()
                                    editParised = "";
                                } else {
                                    layer.msg(res.data.message, {icon: 2});
                                    layer.closeAll('loading');

                                }
                                layer.close(dIndex);

                            })
                            .catch(function (error) {
                                console.log(error);
                                if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                                    // 进行重新登陆
                                    localStorage.clear();
                                    top.location.href=loginPageUrl;
                                }
                            })
                        return false;
                    });
                }
            });
        })

    }

    /*显示删除指标弹窗*/
    function showIdenManageDeleteModel(data) {

        layer.confirm('确认删除吗？', {
            skin: 'layui-layer-admin',
            size:'sm',
            shade: .1
        }, function () {
            axios({
                method: 'delete',
                url:idenManageUrl.idenManageData.deleteIdenMeta + data.id,
                headers:{
                    'Authorization':Authorization
                }
            })
                .then(function (res) {
                    if (res.status == 200&&res.data.message=="success") {
                        layer.closeAll('loading');
                        layer.msg("删除成功", {icon: 1});
                        getIdenData()
                    } else {
                        layer.msg(res.data.message, {icon: 2});
                        layer.closeAll('loading');
                    }
                    layer.closeAll('loading');

                })
                .catch(function (error) {
                    console.log(error);
                    if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                        // 进行重新登陆
                        localStorage.clear();
                        top.location.href=loginPageUrl;
                    }
                })
        });
    }

    /*显示更多筛选框*/
    function openMoreFilterModel() {
        $("#idenMoreFilterModel").slideDown();
    }
    /*显示新增指标弹窗*/
    function openAddIdenManage() {
        layui.use(['admin'], function () {
            var $ = layui.jquery;
            var admin = layui.admin;
            var form = layui.form;
            admin.open({
                type: 1,
                title: '新增指标',
                offset: "auto",
                area: ['400px', '800px'],
                content: $('#model-add-idenManage').html(),
                success: function (layero, dIndex) {
                    form.render('select')
                    form.render('checkbox')
                    var resArr = [{"data_type":0,
                        "id":"root",
                        "name":"根目录",
                        "par_id":"",
                        "version":"0",
                        "sub":[]
                    }];
                    $.fn.zTree.init($("#addIdenTree"),idenSetting.identValueSetting, resArr);
                    // getTreeTable({},function (resArr) {
                    //     $.fn.zTree.init($("#addIdenTree"),idenSetting.identValueSetting, resArr);
                    //     // parentId = resArr[0]
                    //     // first_renderTree = true;
                    //     // getTableData(resArr[0].id,{})
                    // });
                    $("#addPrevName").val(editMenu.idenName)
                    var inflow_str = template("template-inflow-tmpl",{inflowData});
                    document.getElementById("addInFlow").innerHTML = inflow_str
                    var flowout_str = template("template-flowOut-tmpl",{flowOutData});
                    document.getElementById("addFlowOut").innerHTML = flowout_str
                    form.render('select')
                    form.on('submit(addIdenDataList)', function (data) {
                        let formData = {
                            idenName:data.field.idenName,
                            allName :data.field.allName,
                            idenType:2,
                            idenLength :data.field.idenLength,
                            idenPrecision :data.field.idenPrecision,
                            status :data.field.status?"1":"0",
                            memo:data.field.memo,
                            parid :addPariseId?addPariseId:editMenu.id,
                            dataProcurement :data.field.dataProcurement,
                            dataUse :data.field.dataUse,
                        }
                        axios({
                            method: 'post',
                            data:formData,
                            url:idenManageUrl.idenManageData.addIdenMeta,
                            headers:{
                                'Authorization':Authorization
                            }
                        })
                            .then(function (res) {
                                if (res.status == 200&&res.data.message=="success") {
                                    layer.closeAll('loading');
                                    layer.msg("新增成功", {icon: 1});
                                    addPariseId = "";
                                    getIdenData();
                                } else {
                                    layer.msg(res.data.message, {icon: 2});
                                    layer.closeAll('loading');

                                }
                                layer.close(dIndex);
                            })
                            .catch(function (error) {
                                console.log(error);
                                if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                                    // 进行重新登陆
                                    localStorage.clear();
                                    top.location.href=loginPageUrl;
                                }
                            })
                        return false;
                    });
                }
            });
        })

    }
    //获取表格信息
    function getIdenData() {
        var req={
            current: current,
            size: pageSize,
            dirid:editMenu.id
        };
        axios.get(idenManageUrl.idenManageData.searchIdenMeta,{
            params: req,
            headers:{
                'Authorization':Authorization
            }
        })
            .then(function (response) {
                if(response.status == 200 &&response.data.message == "success"){
                    var data = response.data.data;
                    renderTable(data)
                }
            })
            .catch(function (error) {
                console.log(error)
                if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                    // 进行重新登陆
                    localStorage.clear();
                    top.location.href=loginPageUrl;
                }
            });
    }
    //查询流入渠道
    function inflow() {
        axios.get(idenManageUrl.idenManageData.getProcurement,{
            headers:{
                'Authorization':Authorization
            }
        })
            .then(function (response) {
                if(response.status == 200 &&response.data.message == "success"){
                    var data = response.data.data;
                    inflowData = data
                }
            })
            .catch(function (error) {
                console.log(error)
                if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                    // 进行重新登陆
                    localStorage.clear();
                    top.location.href=loginPageUrl;
                }
            });
    }
    //查询流出方式
    function flowOut() {
        axios.get(idenManageUrl.idenManageData.getUseType,{
            headers:{
                'Authorization':Authorization
            }
        })
            .then(function (response) {
                if(response.status == 200 &&response.data.message == "success"){
                    var data = response.data.data;
                    flowOutData = data
                }
            })
            .catch(function (error) {
                console.log(error)
                if(error.response.status === 401 || error.response.status === 403 || error.response.status === 406){
                    // 进行重新登陆
                    localStorage.clear();
                    top.location.href=loginPageUrl;
                }
            });
    }
});


